#pragma once

#include "Widget.h"
#include "SimpleText.h"
#include "GLFont2D.h"
#include "ColorRGB.h"
#include <boost/signals2/signal.hpp>

namespace game_engine { namespace gui
{

/*!
 * \class AbstractButton
 * \brief 
 */
class AbstractButton : public Widget
{
///////////////////////////////////////////////////////////////////////////////
// Attribute definition
///////////////////////////////////////////////////////////////////////////////
public:
    typedef boost::signals2::signal<void ()>  signal_void_void_t;
    typedef boost::signals2::signal<void (BOOL)>  signal_void_bool_t;

protected:
    components::SimpleText *_simpleText;

private:
    BOOL _checkable;
    BOOL _checked;
    BOOL _down;
    signal_void_bool_t _signalClicked;
    signal_void_void_t _signalPressed;
    signal_void_void_t _signalReleased;
    signal_void_bool_t _signalToggled;

///////////////////////////////////////////////////////////////////////////////
// Method definition
///////////////////////////////////////////////////////////////////////////////
public:
    // Constructors and Destructors
    AbstractButton(void);
    AbstractButton(Scene *scene, const string &name, const string &tag, 
        const DrawLevelType drawLevel);
    virtual ~AbstractButton(void);

    // Others
    boost::signals2::connection connect(signal_void_void_t &publisher, 
        const signal_void_void_t::slot_type &subscriber);
    boost::signals2::connection connect(signal_void_bool_t &publisher, 
        const signal_void_bool_t::slot_type &subscriber);

    virtual void update(const FLOAT32 time);

    // Getters
    const BOOL isCheckable(void) const;
    const BOOL isChecked(void) const;
    const BOOL isDown(void) const;
    signal_void_bool_t& signalClicked(void);
    signal_void_void_t& signalPressed(void);
    signal_void_void_t& signalReleased(void);
    signal_void_bool_t& signalToggled(void);
    const string& text(void) const;

    // Setters
    void setCheckable(const BOOL checkable);
    void setChecked(const BOOL checked);
    void setDown(const BOOL down);
    void setEnabled(const BOOL enabled);
    void setFocus(const BOOL focus);
    void setFont(const open_gl::FontType font);
    void setText(const string& text);
    void setTextColor(const utils::ColorRGB &color);

};

}}
